<%@ page contentType="text/html; charset=UTF-8"%>
<%@ include file="/WEB-INF/view/system/common/head.jsp"%>
<style>
 .labelTd{
    width:100px;
    text-align:right;
 }
</style>

<body>
	<div id="p" class="easyui-panel" title="修改用户信息" style="padding: 10px; background: #fafafa;text-align:center;">
		<form id="userUpdateForm" name="userUpdateForm" method="post">
		
				<table class="infoTable">
					<tr>
						<td class="labelTd">总分组：
							<input type="hidden" name="id" value="${oldUser.id}" />
						</td>
						<td  class="redText">
							${oldUser.areaname}
						</td>
					</tr>
					<tr>
						<td class="labelTd">
							分组名称：
						</td>
						<td class="redText">
							${oldUser.groupname}
						</td>
					</tr>
					<tr>
						<td class="labelTd">
							用户名<span class="colrRed"> * </span>：
						</td>
						<td >
							<input type="text" id="newUser_username" name="username"
							   class="easyui-validatebox myinput" 
								required="true" 
								missingMessage="请输入用户名"  placeholder="请输入用户名" 
								value="${oldUser.username }"/>
						</td>					
					</tr>
					
					<tr>
					   <td class="labelTd">工号 :</td>
						<td >
						<input type="text" id="newUser_code" name="code"
								maxlength="8" class="easyui-validatebox myinput" 
								precision="0" min="1" max="99999999"
								required="true" 
								missingMessage="请输入用户工号"  placeholder="请输入用户工号"
								value="${oldUser.code }"/>
						
						</td>
					</tr>
					
					<tr>
						<td class="labelTd">
							姓名 :
						</td>
						<td >
							<input type="text" id="newUser_name" name="name"
								 maxlength="30" class="easyui-validatebox myinput" 
								 required="true" validType="length[1,30]" 
								 missingMessage="请输入用户姓名"  placeholder="请输入用户姓名"
								value="${oldUser.name }"/>
						
						</td>
					</tr>
					
						<tr>
						<td class="labelTd">
							身份证号 :
						</td>
						<td >
							<input type="text" id="newUser_idcard" name="idcard"
								maxlength="30" class="easyui-validatebox  myinput" 
								placeholder="请输入用户身份证"
								value="${oldUser.idcard }"/>
						</td>
					</tr>
				
					<tr>
						<td class="labelTd">
							手机 :
						</td>
						<td >
							<input type="text" id="newUser_telephone"
								name="telephone" class="easyui-validatebox myinput" 
								placeholder="请输入用户手机" value="${oldUser.telephone }"/>
						</td>
					</tr>
					
					<tr>
						<td class="labelTd">
							地址 :
						</td>
						<td ><textarea class="easyui-validatebox" id="newUser_address"
								name="address"  rows="3" 
								cols="50" >${oldUser.address }</textarea>
						</td>
					</tr>

					<tr>
						<td class="labelTd">
							备注 :
						</td>
						<td ><textarea class="easyui-validatebox" id="newUser_descr"
								name="descr"  rows="3" 
								cols="50" >${oldUser.descr }</textarea>
						</td>
					</tr>
					
				</table>
			
			<div style="text-align:center;padding-top:10px;">
				<br />
				<a class="easyui-linkbutton myLink" iconCls="icon-ok"
					onclick="submitFrom()">修改</a>
				&nbsp;&nbsp;&nbsp;
				<a  class="easyui-linkbutton myLink" iconCls="icon-undo"
					onclick="resetForm()">重置 </a>
			</div>
		</form>
	</div>
</body>

<script>
//重置
function resetForm() {
	$("#userAddForm").form('reset');
}

//页面提交
function submitFrom() {
	//判断参数是否为空
	var valid = $('#userUpdateForm').form('validate');
	if (valid) {
		var param = $('#userUpdateForm').serializeJson(true);
		$.axs("user/doUserUpdate.action", param, 
                function(data){
			if(data.status == 1){
				$.messager.alert("提示信息",
						data.msg, 'info', function() {
					parent.$('#tt').tabs('close', parent.$('#tt').tabs('getSelected').panel('options').title);
				});
			}else{
				$.messager.alert("提示信息", data.msg, 'error');
			}
		});
		
	}
}

function callbackAddCustomer(date) {
	if (date != "") {
		var json = eval("(" + date + ")");
		if (json.records[0].messageCode == messageCodeSuccess) {
			$.messager.alert("<s:text name='mes.message'/>", json.records[0].messageDesc, 'info', function() {
				//resetFrom();
					parent.$('#tt').tabs('close', parent.$('#tt').tabs('getSelected').panel('options').title);
				});
		} else {
			$.messager.alert("<s:text name='mes.message'/>", json.records[0].messageDesc, 'error');
		}
	}
}
</script>
</html>